home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / tbplus / tbplus.frm < prev    next >
Text File  |  1995-12-05  |  4KB  |  92 lines

  1. VERSION 2.00
  2. Begin Form Form1 
  3.    BackColor       =   &H00C0C0C0&
  4.    BorderStyle     =   1  'Fixed Single
  5.    Caption         =   "Text Box Insert and Overstrike Demo"
  6.    ClientHeight    =   4890
  7.    ClientLeft      =   180
  8.    ClientTop       =   435
  9.    ClientWidth     =   8235
  10.    Height          =   5295
  11.    Left            =   120
  12.    LinkTopic       =   "Form1"
  13.    MaxButton       =   0   'False
  14.    ScaleHeight     =   4890
  15.    ScaleWidth      =   8235
  16.    Top             =   90
  17.    Width           =   8355
  18.    Begin TextBox txt_TextBoxPlus 
  19.       BackColor       =   &H00C0C0C0&
  20.       Height          =   2490
  21.       Left            =   135
  22.       MultiLine       =   -1  'True
  23.       ScrollBars      =   2  'Vertical
  24.       TabIndex        =   0
  25.       Top             =   2145
  26.       Width           =   8055
  27.    End
  28.    Begin Label lbl_IOMode 
  29.       AutoSize        =   -1  'True
  30.       BackColor       =   &H00C0C0C0&
  31.       Caption         =   "INS"
  32.       Height          =   195
  33.       Left            =   7815
  34.       TabIndex        =   2
  35.       Top             =   4680
  36.       Width           =   330
  37.    End
  38.    Begin Label Label3 
  39.       AutoSize        =   -1  'True
  40.       BackColor       =   &H00C0C0C0&
  41.       Caption         =   "Insert or Overstrike mode:"
  42.       Height          =   195
  43.       Left            =   5520
  44.       TabIndex        =   3
  45.       Top             =   4665
  46.       Width           =   2220
  47.    End
  48.    Begin Label Label1 
  49.       AutoSize        =   -1  'True
  50.       BackColor       =   &H00C0C0C0&
  51.       Caption         =   "The standard Visual Basic text box control is a very basic text box.  Normally, if you want multiple fonts, multiple tabs, multiple styles, or overstrike AND insert mode, you'd have to go commercial.  This is a demonstration of how you can implement both overstrike and insert mode.  It was written by Daniel Trimble and is placed in the Public Domain.  Do as you wish with this demo, but I, nor the distributers of this product (namely online services, vendors, or anyone else having anything to do with the distribution or reproduction of this demo) are at fault for anything.  Comments and questions and suggestions are always welcome, and can be emailed to the address DGTrimble@IFiveBBS@win.net. or to EFVE25D@prodigy.com."
  52.       FontBold        =   0   'False
  53.       FontItalic      =   0   'False
  54.       FontName        =   "MS Sans Serif"
  55.       FontSize        =   9.75
  56.       FontStrikethru  =   0   'False
  57.       FontUnderline   =   0   'False
  58.       Height          =   1920
  59.       Left            =   60
  60.       TabIndex        =   1
  61.       Top             =   30
  62.       Width           =   8235
  63.       WordWrap        =   -1  'True
  64.    End
  65. End
  66. Sub Form_Load ()
  67.    InsertMode = True       'make Insert active on startup
  68.    Me.Move (screen.Width - Me.Width) / 2, (screen.Height - Me.Height) / 2
  69.                            'centers the demo window on the screen
  70. End Sub
  71.  
  72. Sub txt_TextBoxPlus_KeyPress (KeyAscii As Integer)
  73.    If InsertMode = False Then
  74.       If KeyAscii <> 8 And KeyAscii <> 13 And txt_TextBoxPlus.SelLength = 0 Then
  75.          txt_TextBoxPlus.SelLength = 1
  76.       End If
  77.    End If
  78. End Sub
  79.  
  80. Sub txt_TextBoxPlus_KeyUp (KeyCode As Integer, Shift As Integer)
  81.    If KeyCode = KEY_INSERT Then        'Insert pressed?
  82.       If InsertMode = True Then        'was Insert active?
  83.          InsertMode = False            'yes, so make it inactive.  Now we're in overstrike mode
  84.          lbl_IOMode.Caption = "OVR"
  85.       ElseIf InsertMode = False Then   'nope, overstrike was active
  86.          InsertMode = True             'make Insert mode active
  87.          lbl_IOMode.Caption = "INS"    'display the new mode on the status lin
  88.       End If
  89.    End If
  90. End Sub
  91.  
  92.